home *** CD-ROM | disk | FTP | other *** search
- Path: sourcery.han.de!not-for-mail
- Newsgroups: comp.sys.amiga.programmer
- References: <311cf9aa@beachyhd.demon.co.uk>
- From: "Olaf Barthel" <olsen@sourcery.han.de>
- Date: Mon, 12 Feb 1996 15:01:42 +0100
- X-NewsReader: IntuiNews 1.3a (7.9.95)
- Subject: Re: SetRGB32() doesn't do what it should..
- Message-ID: <13213605@sourcery.han.de>
-
- In Article <311cf9aa@beachyhd.demon.co.uk>, Adam <Adam@beachyhd.demon.co.uk> wrote:
- > In a message of 07 Feb 96 Robby Paehlig wrote to All:
- >
- > RP> Here are some lines, that should change color 8 of my Workbench to
- > RP> blue:
- >
- > RP> [...]
- > RP> if(GfxBase = (struct GfxBase *)(OpenLibrary("graphics.library", 39L)))
- > RP> {
- > RP> if(wb = LockPubScreen("Workbench")) {
- > RP> SetRGB32(&(wb->ViewPort), 8, 0x0ul, 0x0ul, 0xFFul);
- > RP> [...]
- >
- > RP> Well, the color changes -- not to blue, but to black! What I'm doing
- > RP> wrong?
- >
- > You need to specify the colours as a "32 bit left justified fraction". What
- > this basically means is that bits 24-31 are the bits to use for 8-bit colour.
- > To set your colour to blue, try this:
- >
- > SetRGB32(&(wb->ViewPort), 8, 0x00000000, 0x00000000, 0xFF000000);
-
- Not exactly correct. This should read
-
- SetRGB32(&(wb->ViewPort), 8, 0x00000000, 0x00000000, 0xFFFFFFFF);
-
- Here is a simple 24->96 bit conversion routine:
-
- VOID
- SetRGB8(struct ViewPort *vp,LONG index,LONG r,LONG g,LONG b)
- {
- SetRGB32(vp,index,r * 0x01010101,g * 0x01010101,b * 0x01010101);
- }
-
- --
- Home: Olaf Barthel, Brabeckstrasse 35, D-30559 Hannover
- Net: olsen@sourcery.han.de
-